import React from 'react' 


const withtoLi = (Component)=>{
    // 函数组件  高阶组件约定俗成以 with 开头
    const newComp = props=>{
        return <Component {...props} name="react高阶组件测试" />
    }
    return newComp
}

const withLog = Component=>{
    class NewComponent extends React.Component{
        componentWillMount(){
            console.log(`组件${Component.name}准备渲染`);
        }
        render(){
            return <Component {...this.props}/>
        }
        componentDidMount(){
            console.log(`组件名:${Component.name}`,);
        }
    }
    return NewComponent
}

class App extends React.Component{
    render(){
        return <div>
            <h1>litthy</h1>
            <h2>{this.props.name}</h2>
        </div>
    }
}

App = withLog(withtoLi(App))

export default App